<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
























<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.0.1">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.0.1">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.0.1">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.0.1">


  <link rel="mask-icon" href="/images/logo.svg?v=7.0.1" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.0.1',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: true,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="想必大家都一定用过spring框架，每次整合spring框架的时候总是会有无穷无尽的xml配置文件，第一次写配置文件的时候，大家还会抱着学习的心态认真读每一个配置，但是当我们每次在构建项目都要写同样的配置文件大家应该会觉得厌烦，尽管只是复制粘贴。那么现在你就不用担心了，使用springboot让你更简单的构建spring应用。">
<meta name="keywords" content="SpringBoot">
<meta property="og:type" content="article">
<meta property="og:title" content="【SpringBoot2.0系列01】初识SpringBoot">
<meta property="og:url" content="http://www.yukonga.cn/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/index.html">
<meta property="og:site_name" content="yukong&#39;s blog">
<meta property="og:description" content="想必大家都一定用过spring框架，每次整合spring框架的时候总是会有无穷无尽的xml配置文件，第一次写配置文件的时候，大家还会抱着学习的心态认真读每一个配置，但是当我们每次在构建项目都要写同样的配置文件大家应该会觉得厌烦，尽管只是复制粘贴。那么现在你就不用担心了，使用springboot让你更简单的构建spring应用。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-d2c142a6633ec39a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-190d26d4b8e134f5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-305f00648d01bedc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-cea92176799a5647.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-9bea1db3ec2ac607.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/5338436-dc90c849f6a2ab3f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="http://cdn.yukonga.cn/2019-05-07-055539.jpg">
<meta property="og:updated_time" content="2019-07-22T08:49:43.867Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="【SpringBoot2.0系列01】初识SpringBoot">
<meta name="twitter:description" content="想必大家都一定用过spring框架，每次整合spring框架的时候总是会有无穷无尽的xml配置文件，第一次写配置文件的时候，大家还会抱着学习的心态认真读每一个配置，但是当我们每次在构建项目都要写同样的配置文件大家应该会觉得厌烦，尽管只是复制粘贴。那么现在你就不用担心了，使用springboot让你更简单的构建spring应用。">
<meta name="twitter:image" content="https://upload-images.jianshu.io/upload_images/5338436-d2c142a6633ec39a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">



  <link rel="alternate" href="/atom.xml" title="yukong's blog" type="application/atom+xml">




  <link rel="canonical" href="http://www.yukonga.cn/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>【SpringBoot2.0系列01】初识SpringBoot | yukong's blog</title>
  






  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?45b7a3cfe46b3fa2c5d46f59f590664e";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>







  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">yukong's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">learning program</p>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://www.yukonga.cn/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="yukong">
      <meta itemprop="description" content="你若对得起时间，时间便对得起你">
      <meta itemprop="image" content="/uploads/avatar.png">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="yukong's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">【SpringBoot2.0系列01】初识SpringBoot

              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-08-14 00:10:06" itemprop="dateCreated datePublished" datetime="2018-08-14T00:10:06+08:00">2018-08-14</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-07-22 16:49:43" itemprop="dateModified" datetime="2019-07-22T16:49:43+08:00">2019-07-22</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/SpringBoot/" itemprop="url" rel="index"><span itemprop="name">SpringBoot</span></a></span>

                
                
              
            </span>
          

          
            
            
              
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
            
                <span class="post-meta-item-text">评论数：</span>
                <a href="/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
            <span id="/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/" class="leancloud_visitors" data-flag-title="【SpringBoot2.0系列01】初识SpringBoot">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              
                <span class="post-meta-item-text">阅读次数：</span>
              
                <span class="leancloud-visitors-count"></span>
            </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>想必大家都一定用过spring框架，每次整合spring框架的时候总是会有无穷无尽的xml配置文件，第一次写配置文件的时候，大家还会抱着学习的心态认真读每一个配置，但是当我们每次在构建项目都要写同样的配置文件大家应该会觉得厌烦，尽管只是复制粘贴。那么现在你就不用担心了，使用springboot让你更简单的构建spring应用。</p>
<a id="more"></a>
<h1 id="一-介绍"><a class="markdownIt-Anchor" href="#一-介绍"></a> 一、介绍</h1>
<p>springboot让我们更加简单快速的构建spring应用，并且内置web容器（tomcat、jetty等）支持jar包的方式启动一个web应用。</p>
<h4 id="springboot主要优点"><a class="markdownIt-Anchor" href="#springboot主要优点"></a> SpringBoot主要优点：</h4>
<ul>
<li>
<ol>
<li>为所有Spring开发者更快的入门</li>
</ol>
</li>
<li>
<ol start="2">
<li>开箱即用，提供各种默认配置来简化项目配置</li>
</ol>
</li>
<li>
<ol start="3">
<li>内嵌式容器简化Web项目</li>
</ol>
</li>
<li>
<ol start="4">
<li>没有冗余代码生成和XML配置的要求</li>
</ol>
</li>
</ul>
<h1 id="二-目标"><a class="markdownIt-Anchor" href="#二-目标"></a> 二、目标</h1>
<p>本节主要目标是通过构建一个简单的SpringBoot项目，实现一个hello word接口。通过这样一个简单的例子让我们对springboot有一个了解。</p>
<h1 id="三-实现"><a class="markdownIt-Anchor" href="#三-实现"></a> 三、实现</h1>
<h2 id="31-环境"><a class="markdownIt-Anchor" href="#31-环境"></a> 3.1、环境</h2>
<ul>
<li>java8 及以上</li>
<li>SpringBoot 2.0.4</li>
</ul>
<h2 id="32-构建项目"><a class="markdownIt-Anchor" href="#32-构建项目"></a> 3.2 构建项目</h2>
<h3 id="321-spring官网-spring-initializr"><a class="markdownIt-Anchor" href="#321-spring官网-spring-initializr"></a> 3.2.1 spring官网 SPRING INITIALIZR</h3>
<p>1、访问 <code>http://start.spring.io/</code></p>
<p>2、选择<code>maven</code>构建、使用<code>java</code>语法、并且<code>SpringBoot</code>版本为2.0.4</p>
<p>具体如图：</p>
<p><img src="https://upload-images.jianshu.io/upload_images/5338436-d2c142a6633ec39a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>3、点击<code>Generate Project</code> 下载构建成功的项目压缩包</p>
<p>解压完成之后我们就可以通过IntelliJ IDEA开发工具导入到工程，</p>
<ul>
<li>
<ol>
<li>菜单中选择File–&gt;New–&gt;Project from Existing Sources…</li>
</ol>
</li>
<li>
<ol start="2">
<li>选择解压后的项目文件夹，点击OK</li>
</ol>
</li>
<li>
<ol start="3">
<li>点击Import project from external model并选择Maven，点击Next到底为止。</li>
</ol>
</li>
<li>
<ol start="4">
<li>如果你的环境有多个版本的JDK，注意到选择Java SDK的时候请选择系统安装1.8版本</li>
</ol>
</li>
</ul>
<h3 id="322-使用idea构建"><a class="markdownIt-Anchor" href="#322-使用idea构建"></a> 3.2.2 使用idea构建</h3>
<p>1、打开idea选择<code>new</code> -&gt; <code>project</code> -&gt; <code>SPRING INITIALIZR</code><br>
<img src="https://upload-images.jianshu.io/upload_images/5338436-190d26d4b8e134f5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="idea构建"></p>
<p>2、在ProjectSDK选择<code>jdk8</code><br>
3、点击<code>next</code> 输入<code>gourpId artifactId</code> 然后继续<code>next</code> 一直到完成就可以<br>
<img src="https://upload-images.jianshu.io/upload_images/5338436-305f00648d01bedc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>其实大家看的出来，两种方式都是一样的，只不过用idea省去了我们手动下载介绍并且导入的步骤，稍显方便。</p>
<h3 id="323-项目结构"><a class="markdownIt-Anchor" href="#323-项目结构"></a> 3.2.3、项目结构</h3>
<p><img src="https://upload-images.jianshu.io/upload_images/5338436-cea92176799a5647.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>关键目录解释</p>
<ul>
<li>1、<code>/src/main/java/</code>  存放项目所有源代码目录</li>
<li>2、<code>/src/main/resources/</code> 存放项目所有资源文件以及配置文件目录</li>
<li>3、<code>/src/test/</code> 存放测试代码目录</li>
</ul>
<p>其中生成的Chapter1Application和Chapter1ApplicationTests类都可以直接运行来启动当前创建的项目。</p>
<h2 id="33-添加web模块"><a class="markdownIt-Anchor" href="#33-添加web模块"></a> 3.3、添加web模块</h2>
<p>打开pom.xml  添加spring-boot-starter-web 即可</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">&lt;dependencies&gt;</span><br><span class="line">        &lt;dependency&gt;</span><br><span class="line">            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;</span><br><span class="line">            &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;</span><br><span class="line">        &lt;/dependency&gt;</span><br><span class="line"></span><br><span class="line">        &lt;dependency&gt;</span><br><span class="line">            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;</span><br><span class="line">            &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;</span><br><span class="line">            &lt;scope&gt;test&lt;/scope&gt;</span><br><span class="line">        &lt;/dependency&gt;</span><br><span class="line"></span><br><span class="line">        &lt;dependency&gt;</span><br><span class="line">            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;</span><br><span class="line">            &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;</span><br><span class="line">        &lt;/dependency&gt;</span><br><span class="line">    &lt;/dependencies&gt;</span><br></pre></td></tr></table></figure>
<h2 id="34-编写hello-world服务"><a class="markdownIt-Anchor" href="#34-编写hello-world服务"></a> 3.4、编写hello world服务</h2>
<p>在<code>src/main/java</code>目录下的<code>chapter1</code>包下新建一个<code>HelloWorldController.java</code>文件</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@RestController</span></span><br><span class="line"><span class="meta">@RequestMapping</span>(<span class="string">"/hello"</span>)</span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">HelloWorldController</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@GetMapping</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">hello</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="string">"hello world"</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>其中</p>
<ul>
<li><code>@RequestController</code>是一个复合注解 ，大家按住ctrl看源码会发现 <code>@RequestController = @Controller +@ResponseBody</code> 那么它的作用就不言而喻了，代表当前类是一个控制器并且返回所有的方法将会返回<code>json</code>数据</li>
</ul>
<h2 id="35-启动"><a class="markdownIt-Anchor" href="#35-启动"></a> 3.5 、启动</h2>
<p>双击打开<code>Chapter1Application</code>文件启动。</p>
<p><img src="https://upload-images.jianshu.io/upload_images/5338436-9bea1db3ec2ac607.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>从图中可以看出日志打印启动tomcat服务的端口是8080 ，代表启动成功。</p>
<p>打开浏览器访问<code>http://localhost:8080/hello</code></p>
<p><img src="https://upload-images.jianshu.io/upload_images/5338436-dc90c849f6a2ab3f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="image.png"></p>
<p>那么有时候我们的8080端口被占用了，那么就会启动失败，提示端口被占用，如何改变<code>springboot</code>启动的默认端口呢？</p>
<p>打开<code>application.yml</code>  这时候大家就会问了 不是<code>application.properties</code>吗 其实yml文件也是配置文件的一种，它的书写简洁，我比较喜欢。</p>
<p><code>yml写法</code></p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">server:</span></span><br><span class="line"><span class="attr">  port:</span> <span class="number">9090</span></span><br></pre></td></tr></table></figure>
<p><code>properties写法</code></p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">server.port</span>=<span class="string">9090</span></span><br></pre></td></tr></table></figure>
<p>上面的代码就是设置web服务启动的端口了。</p>
<h1 id="四-总结"><a class="markdownIt-Anchor" href="#四-总结"></a> 四、总结</h1>
<p>通过这次学习，我们了解了<code>springboot</code>如何启动一个<code>web</code>服务，并且如何更改<code>web</code>服务启动的默认端口。</p>
<p>最后配套教程的代码全部在这里<br>
<a href="https://github.com/YuKongEr/SpringBoot-Study" target="_blank" rel="noopener">github https://github.com/YuKongEr/SpringBoot-Study</a>。麻烦点个star或者fork吧。</p>
<p>欢迎大家关注一下我的个人公众号。一起交流一起学习，有问必答。<br>
<img src="http://cdn.yukonga.cn/2019-05-07-055539.jpg" alt=""></p>

      
    </div>

    

    
    
    

    

    
      
    
    
      <div>
        <div id="reward-container">
  <div>喜欢就请博主喝个☕️吧</div>
  <button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
    打赏
  </button>
  <div id="qr" style="display: none;">

    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/wechatpay.jpg" alt="yukong 微信支付">
        <p>微信支付</p>
      </div>
    
      
      
        
      
      <div style="display: inline-block">
        <img src="/images/alipay.jpg" alt="yukong 支付宝">
        <p>支付宝</p>
      </div>
    

  </div>
</div>

      </div>
    

    
      <div>
        




  



<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>yukong</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    
    <a href="http://www.yukonga.cn/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/" title="【SpringBoot2.0系列01】初识SpringBoot">http://www.yukonga.cn/2018/08/14/【SpringBoot2-0系列01】初识SpringBoot/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc/4.0/" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC</a> 许可协议。转载请注明出处！</li>
</ul>

      </div>
    
    

      <div>
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/SpringBoot/" rel="tag"><i class="fa fa-tag"></i> SpringBoot</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/08/15/【SpringBoot2-0系列02】SpringBoot之使用Thymeleaf视图模板/" rel="prev" title="【SpringBoot2.0系列02】SpringBoot之使用Thymeleaf视图模板">
                【SpringBoot2.0系列02】SpringBoot之使用Thymeleaf视图模板 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/uploads/avatar.png" alt="yukong">
            
              <p class="site-author-name" itemprop="name">yukong</p>
              <div class="site-description motion-element" itemprop="description">你若对得起时间，时间便对得起你</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">26</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">6</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">36</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/YuKongEr" title="GitHub &rarr; https://github.com/YuKongEr" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="mailto:yukongcode@gmail.com" title="E-Mail &rarr; mailto:yukongcode@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://www.jianshu.com/u/bc2e35b66293" title="简书 &rarr; https://www.jianshu.com/u/bc2e35b66293" rel="noopener" target="_blank"><i class="fa fa-fw fa-skype"></i>简书</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://blog.csdn.net/xp541130126" title="csdn &rarr; https://blog.csdn.net/xp541130126" rel="noopener" target="_blank"><i class="fa fa-fw fa-vk"></i>csdn</a>
                </span>
              
            </div>
          

          

          
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#一-介绍"><span class="nav-number">1.</span> <span class="nav-text"> 一、介绍</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#springboot主要优点"><span class="nav-number">1.0.0.1.</span> <span class="nav-text"> SpringBoot主要优点：</span></a></li></ol></li></ol><li class="nav-item nav-level-1"><a class="nav-link" href="#二-目标"><span class="nav-number">2.</span> <span class="nav-text"> 二、目标</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#三-实现"><span class="nav-number">3.</span> <span class="nav-text"> 三、实现</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#31-环境"><span class="nav-number">3.1.</span> <span class="nav-text"> 3.1、环境</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#32-构建项目"><span class="nav-number">3.2.</span> <span class="nav-text"> 3.2 构建项目</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#321-spring官网-spring-initializr"><span class="nav-number">3.2.1.</span> <span class="nav-text"> 3.2.1 spring官网 SPRING INITIALIZR</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#322-使用idea构建"><span class="nav-number">3.2.2.</span> <span class="nav-text"> 3.2.2 使用idea构建</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#323-项目结构"><span class="nav-number">3.2.3.</span> <span class="nav-text"> 3.2.3、项目结构</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#33-添加web模块"><span class="nav-number">3.3.</span> <span class="nav-text"> 3.3、添加web模块</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#34-编写hello-world服务"><span class="nav-number">3.4.</span> <span class="nav-text"> 3.4、编写hello world服务</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#35-启动"><span class="nav-number">3.5.</span> <span class="nav-text"> 3.5 、启动</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#四-总结"><span class="nav-number">4.</span> <span class="nav-text"> 四、总结</span></a></li></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">yukong</span>

  

  
</div>
<div class="BbeiAn-info">
浙ICP备 -
<a target="_blank" href="http://www.miitbeian.gov.cn">19015067号</a>

</div>









        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
      您是访问本站的第&nbsp
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      &nbsp 位朋友
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
      本站总共访问&nbsp
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      次
    </span>
  
</div>









        
      </div>
    </footer>

    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/src/utils.js?v=7.0.1"></script>

  <script src="/js/src/motion.js?v=7.0.1"></script>



  
  


  <script src="/js/src/affix.js?v=7.0.1"></script>

  <script src="/js/src/schemes/pisces.js?v=7.0.1"></script>




  
  <script src="/js/src/scrollspy.js?v=7.0.1"></script>
<script src="/js/src/post-details.js?v=7.0.1"></script>



  


  <script src="/js/src/next-boot.js?v=7.0.1"></script>


  

  

  

  
  

<script src="//cdn1.lncld.net/static/js/3.11.1/av-min.js"></script>



<script src="//unpkg.com/valine/dist/Valine.min.js"></script>

<script>
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail,link';
  guest = guest.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: false,
    notify: false,
    appId: 'UXuVTqzKQgCJRWTkO8K60EXL-gzGzoHsz',
    appKey: 'n3ohmj1CGAM1GUfp6SqF4LXh',
    placeholder: 'Just go go',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn'
  });
</script>




  


  




  
  
  <script>
    
    function addCount(Counter) {
      var $visitors = $('.leancloud_visitors');
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();

      Counter('get', '/classes/Counter', { where: JSON.stringify({ url }) })
        .done(function({ results }) {
          if (results.length > 0) {
            var counter = results[0];
            
            Counter('put', '/classes/Counter/' + counter.objectId, JSON.stringify({ time: { '__op': 'Increment', 'amount': 1 } }))
            
              .done(function() {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.time + 1);
              })
            
              .fail(function ({ responseJSON }) {
                console.log('Failed to save Visitor num, with error message: ' + responseJSON.error);
              })
          } else {
            
              Counter('post', '/classes/Counter', JSON.stringify({ title: title, url: url, time: 1 }))
                .done(function() {
                  var $element = $(document.getElementById(url));
                  $element.find('.leancloud-visitors-count').text(1);
                })
                .fail(function() {
                  console.log('Failed to create');
                });
            
          }
        })
        .fail(function ({ responseJSON }) {
          console.log('LeanCloud Counter Error: ' + responseJSON.code + ' ' + responseJSON.error);
        });
    }
    

    $(function() {
      $.get('https://app-router.leancloud.cn/2/route?appId=' + 'UXuVTqzKQgCJRWTkO8K60EXL-gzGzoHsz')
        .done(function({ api_server }) {
          var Counter = function(method, url, data) {
            return $.ajax({
              method: method,
              url: 'https://' + api_server + '/1.1' + url,
              headers: {
                'X-LC-Id': 'UXuVTqzKQgCJRWTkO8K60EXL-gzGzoHsz',
                'X-LC-Key': 'n3ohmj1CGAM1GUfp6SqF4LXh',
                'Content-Type': 'application/json',
              },
              data: data
            });
          };
          
            addCount(Counter);
          
        });
    });
  </script>



  

  

  

  

  

  

  

  

  

  

  
<script>
  $('.highlight').each(function(i, e) {
    var $wrap = $('<div>').addClass('highlight-wrap');
    $(e).after($wrap);
    $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function(e) {
      var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
        return $(e).text();
      }).toArray().join('\n');
      var ta = document.createElement('textarea');
      var yPosition = window.pageYOffset || document.documentElement.scrollTop;
      ta.style.top = yPosition + 'px'; // Prevent page scroll
      ta.style.position = 'absolute';
      ta.style.opacity = '0';
      ta.readOnly = true;
      ta.value = code;
      document.body.appendChild(ta);
      ta.select();
      ta.setSelectionRange(0, code.length);
      ta.readOnly = false;
      var result = document.execCommand('copy');
      
        if (result) $(this).text('复制成功');
        else $(this).text('复制失败');
      
      ta.blur(); // For iOS
      $(this).blur();
    })).on('mouseleave', function(e) {
      var $b = $(this).find('.copy-btn');
      setTimeout(function() {
        $b.text('复制');
      }, 300);
    }).append(e);
  })
</script>


  

  

</body>
</html>
